import 'package:daoyi_ui_admin_getx/app/modules/home/info/info_item_widget.dart';
import 'package:daoyi_ui_admin_getx/app/routes/app_pages.dart';
import 'package:daoyi_ui_admin_getx/app/widgets/common_floating_action_button_widget.dart';
import 'package:daoyi_ui_admin_getx/generated/locales.g.dart';
import 'package:flutter/material.dart';

import 'package:get/get.dart';

import 'productions_controller.dart';

class ProductionsView extends GetView<ProductionsController> {
  const ProductionsView({super.key});

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      child: Scaffold(
        appBar: AppBar(
          title: Text(LocaleKeys.pages_productions_title.tr),
          bottom: TabBar(
            tabs: [
              Tab(text: LocaleKeys.pages_production_title.tr),
              Tab(text: LocaleKeys.pages_collect_title.tr),
            ],
          ),
        ),
        floatingActionButton: CommonFloatingActionButtonWidget(
          LocaleKeys.pages_production_publish_title.tr,
          () {
            Get.toNamed(Routes.PRODUCTIONS_PUBLISH);
          },
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
        body: SafeArea(
          child: TabBarView(
            children: [
              ListView(
                children: controller.dataList
                    .map(
                      (item) => InfoItemWidget(item),
                    )
                    .toList(),
              ),
              ListView(
                children: controller.dataList
                    .map(
                      (item) => InfoItemWidget(item),
                    )
                    .toList(),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
